<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:include="include :: header"></head>
<header th:include="include :: top"></header>
<body id="blog">
<hr>
<!-- nav start -->
<nav class="am-g am-g-fixed blog-fixed blog-nav">
    <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only blog-button"
            data-am-collapse="{target: '#blog-collapse'}"><span class="am-sr-only">导航切换</span> <span
            class="am-icon-bars"></span></button>

    <div th:include="include :: navTop"></div>

</nav>
<hr>


<!-- content srart -->
<div class="am-g am-g-fixed blog-fixed">
    <div class="am-u-md-8 am-u-sm-12" style="padding: 10px;color: #f3d711">
        <span id="city"></span><span id="date"></span><span id="weather"></span><span id="wind"></span><span id="temperature"></span>
        <img style="display: inline-block" id="dayPictureUrl" src=""><img style="display: inline-block" id="nightPictureUrl" src="">
    </div>
    <div class="am-u-md-8 am-u-sm-12">

        <article class="am-g blog-entry-article" th:each="photo:${photoList}">
            <div class="am-u-lg-6 am-u-md-12 am-u-sm-12 blog-entry-img">
                <img th:src="${photo.imgUrl}" th:alt="${photo.imgTitle}" class="am-u-sm-12">
            </div>
            <div class="am-u-lg-6 am-u-md-12 am-u-sm-12 blog-entry-text">
                <span><a href="" class="blog-color">VIP: &nbsp;</a></span>
                <span th:text="${session.userInfo.userName}">  &nbsp;</span>
                <span th:text="${photo.createTime}"></span>
                <h1><a href="" th:text="${photo.imgTitle}"></a></h1>
                <p th:text="${photo.imgDetial}">
                </p>
                <p><a href="" class="blog-continue">continue reading</a></p>
            </div>
            <button
                    type="button"
                    class="am-btn am-btn-warning"
                    th:onclick="'javascript:deleteImg('+${photo.id}+')' ">
                删除
            </button>
        </article>


        <ul class="am-pagination">
            <li class="am-pagination-prev"><a href="">&laquo; Prev</a></li>
            <li class="am-pagination-next"><a href="">Next &raquo;</a></li>
        </ul>
    </div>


    <div class="am-u-md-4 am-u-sm-12 blog-sidebar">
        <div class="blog-sidebar-widget blog-bor">
            <h2 class="blog-text-center blog-title"><span>About ME</span></h2>
            <img src="/myfile/assets/i/f14.jpg" alt="about me" class="blog-entry-img">
            <p>妹纸</p>

            <p>
                我是妹子UI，中国首个开源 HTML5 跨屏前端框架
            </p>
            <p>我不想成为一个庸俗的人。十年百年后，当我们死去，质疑我们的人同样死去，后人看到的是裹足不前、原地打转的你，还是一直奔跑、走到远方的我？</p>
        </div>
        <div class="blog-sidebar-widget blog-bor">
            <h2 class="blog-text-center blog-title"><span>Contact ME</span></h2>
            <p>
                <a href=""><span class="am-icon-qq am-icon-fw am-primary blog-icon"></span></a>
                <a href=""><span class="am-icon-github am-icon-fw blog-icon"></span></a>
                <a href=""><span class="am-icon-weibo am-icon-fw blog-icon"></span></a>
                <a href=""><span class="am-icon-reddit am-icon-fw blog-icon"></span></a>
                <a href=""><span class="am-icon-weixin am-icon-fw blog-icon"></span></a>
            </p>
        </div>
        <div class="blog-clear-margin blog-sidebar-widget blog-bor am-g ">
            <h2 class="blog-title"><span>TAG cloud</span></h2>
            <div class="am-u-sm-12 blog-clear-padding">
                <a href="" class="blog-tag">amaze</a>
                <a href="" class="blog-tag">妹纸 UI</a>
                <a href="" class="blog-tag">HTML5</a>
                <a href="" class="blog-tag">这是标签</a>
                <a href="" class="blog-tag">Impossible</a>
                <a href="" class="blog-tag">开源前端框架</a>
            </div>
        </div>
        <div class="blog-sidebar-widget blog-bor">
            <h2 class="blog-title"><span>么么哒</span></h2>
            <ul class="am-list">
                <li><a href="#">每个人都有一个死角， 自己走不出来，别人也闯不进去。</a></li>
                <li><a href="#">我把最深沉的秘密放在那里。</a></li>
                <li><a href="#">你不懂我，我不怪你。</a></li>
                <li><a href="#">每个人都有一道伤口， 或深或浅，盖上布，以为不存在。</a></li>
            </ul>
        </div>
    </div>
</div>


<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">Amaze UI</div>
        <div class="am-modal-bd">
            你，确定要删除这条记录吗？
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确定</span>
        </div>
    </div>
</div>

<div th:include="include :: footer"></div>
<div th:include="include :: socket"></div>
<script>
    function deleteImg(imgId) {
        $('#my-confirm').modal({
            relatedTarget: this,
            onConfirm: function (options) {
                $.ajax({
                    type: "POST",
                    url: "/photo/deleteImg",
                    contentType: 'application/x-www-form-urlencoded;charset=utf-8',
                    data: {"imgId":imgId},
                    dataType: "json",
                    success: function (res) {
                        if(res.status == 1){
                            layer.msg("删除成功！",function () {
                                window.location.href="/photo/userPhotoList";
                            },1500);
                        }else {
                            layer.msg(res.msg);
                        }
                    },
                    error: function (e) {
                        layer.msg("操作失败，联系管理员：544852009@qq.com");
                    }
                })
                ;

            },
            // closeOnConfirm: false,
            onCancel: function () {

            }
        });
    }

    $(function () {
        $.post("/weather/getWeather",{},function (res) {
            var temp = JSON.parse(res.data);
            if(temp.status != 302){
                $("#city").text(temp.results[0].currentCity);
                $("#date").text(temp.results[0].weather_data[0].date);
                $("#weather").text(temp.results[0].weather_data[0].weather);
                $("#wind").text(temp.results[0].weather_data[0].wind);
                $("#temperature").text(temp.results[0].weather_data[0].temperature);
                $("#dayPictureUrl").attr("src",temp.results[0].weather_data[0].dayPictureUrl);
                $("#nightPictureUrl").attr("src",temp.results[0].weather_data[0].nightPictureUrl);
            }else {
                alert("每"+temp.message);
            }
        })
    })

</script>

</body>
</html>